package org.example.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
  *@ClassName TimeUtils
  *@Author LZB
  *@Date 2022/11/2 17:15
  *@Version 1.0
  **/
public class TimeUtils {
    public static Date getCurrentTime(){
        Calendar calendar = Calendar.getInstance();
        Date currentTime = calendar.getTime();//Thu Apr 01 14:32:45 CST 2021
        return currentTime;
    }
    public static String getCurrentDate(){
        Date date = new Date(System.currentTimeMillis());//获取当前时间
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return sdf.format(date).split(" ")[0];
    }
}